const QwBluetoothIndex = {
    async fetchTicket() {
        const response = await fetch('https://hub.unitedtex.com/zx-portal/api/sys/wecom/getWxJsTicket', {
            method: 'GET',
            mode: 'no-cors', // 强制禁用 CORS
            headers: { 'Content-Type': 'application/json' }
        });
        if (!response.ok) {
            throw new Error('Network response was not ok');
        }

        const data = await response.json();
        if (data.code !== 0) {
            throw new Error(`Error fetching ticket: ${data.message}`);
        }

        return data.data; // 确保这里返回的是 ticket 字符串
    }
};

export default QwBluetoothIndex;